$(function(){
    let ProId = location.href.split('?')[1].split('=')[1]
    fetch(`http://chst.vip:1234/api/getdiscountproduct?productid=${ProId}`).then(response=>{
        return response.json()
    }).then(val=>{
        let valObj = val.result[0]
        console.log(valObj);
        let str = ``
        str+=`  <h4>${valObj.productName}</h4>
                <div class="other">
                    <span>${valObj.productFrom}|${valObj.productTime}</span>
                    <span class="span2">${valObj.productTips}</span>
                    <p>${valObj.productPrice}</p>
                </div>
                <div class="content">
                <p>${valObj.productInfo}</p>
                <img src="${valObj.productImg.match(/[0-9a-zA-Z:/.]+/g)[2]}" alt="">
                </div>`

       $('main').html(str)
        toTop2()
    })
   
})